<?php 
//get library
eval ("?>$library");
?> 

<?php 
$seoData->setTitle($article->getTitle());
$seoData->setDescription(substr(trim(strip_tags($article->getContent())),0, 200));
$seoData->setKeywords($article->getTags());
$seoData->setOgSiteName($_SERVER['SERVER_NAME']);
$seoData->setOgTitle($article->getTitle());
$seoData->setOgDescription(substr(trim(strip_tags($article->getContent())),0, 200));
?>      
            <div class="container">            	                
                <div class="row-fluid">

                    <!-- main content
                    ================================================== -->
                    <div id="mainContent" class="span8">
                        <div id="mainContent_inner">
                        
                        	<!-- Article detail
                    		================================================== -->
                            <article itemscope itemtype="http://schema.org/Article">
                                <h1 class="articleTitle" itemprop="name"><a href="#"><?=$article->getTitle()?></a></h1>
                                <div class="articleMeta clearafter">
                                    <?php 
									$category = $categories[$article->getCategory()];
									$author = $authors[$article->getCreator()];
									?>
                                    <a itemprop="author" href="<?=$author === NULL ? "#" : "/author/".$author->getId() ?>"><i class="icon-user"></i> <?=$author === NULL ? $article->getAuthorName() : $author->getName()?> </a>
                                    | 
                                    <a href="/category/<?=$category === NULL ? "" : $category->getAlias() ?>"><i class="icon-folder-close"></i> <?=$category === NULL ? "" : $category->getName()?></a> 
                                    |
                                    <span itemprop="dateCreated"><i class="icon-calendar"></i> <?=date("M, d Y", $article->getCreated())?></span>                                   
                                    <meta content="UserComments:5" itemprop="interactionCount">
                                </div>
                                <hr />
                                <div class="entry clearafter" itemprop="articleBody">
                                    <details open>
                                        <div class="adv-1 left">
                                        	<!-- Adv BEGIN -->
                                        	<script type="text/javascript"><!--
											google_ad_client = "ca-pub-2883566427648799";
											/* 250x250 */
											google_ad_slot = "2431731086";
											google_ad_width = 250;
											google_ad_height = 250;
											//-->
											</script>
											<script type="text/javascript"
											src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
											</script>
											<!-- Adv END -->
                                        </div>
                                        <?=$article->getContent()?>
                                    </details>
                                </div>     
                            </article>
                            <?php 
                            if ($article->getTags() != "") {
                            	$keywords = split(", ", $article->getTags());
                            ?>
		                    <section class="tagListing" itemscope itemtype="http://schema.org/CreativeWork">
		                    	<div class="module-6">
			                    	<h3 class="title">Keywords</h3>
			                    	<?php 
			                    	for ($i = 0; $i < count($keywords); $i++) {
			                    	?>
			                    	<?=$i > 0 ? ", " : ""?>
			                    	<a href="/tag/<?=$keywords[$i]?>" itemprop="keywords"><?=$keywords[$i]?></a> 
			                    	<?php
			                    	}
			                    	 ?>
			                   	</div>
		                    </section>
		                    <?php } ?>
                            
                            <!-- user info
                    		================================================== -->
                    		<?php 
                    		if ($author != NULL) {
                    		?>
                            <section class="authorInfo" itemscope itemtype="http://schema.org/Person">                                
                                <div class="well well-small">
                                    <div class="row-fluid">
                                        <div class="span3 thumbnails">
                                            <a href="/author/<?=$author->getId() ?>" class="thumbnail">
                                            	<?php 
                                            	if (isset($image) && !empty($image)) {
                                            	?>
                                            	<img itemprop="image" src="<?=$image?>=s120-c" />
                                            	<?php
                                            	} else {
                                            	?>
                                            	<img itemprop="image" src="<?=$baseUrl?>images/icon-author.jpg" />
                                            	<?php }?>
                                            </a>
                                        </div>
                                        <div class="span9">
                                            <h3><a href="/author/<?=$author->getId() ?>" itemprop="name"><?=$author->getName()?></a></h3>
                                            <p><a href="<?=$author->getWebsite()?>" itemprop="url"><?=$author->getWebsite()?></a></p>
                                            <p itemprop="description"><?=$author->getAboutme()?></p>
                                        </div>
                                    </div>
                                </div>
                            </section>
                            <?php 
                    		}
                            ?>
                            
                            <!-- author's articles
                    		================================================== -->
                    		<?php 
                    		if ($uArticles != NULL && count($uArticles) > 0) {
                    		?>
                            <section>
                            	<div class="module-6">
                            		<h3 class="title">Author's articles</h3>
                                    <div class="moduleContent">
                                    	<ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    		<?php 
                                    		for ($i = 0; $i < count($uArticles); $i++) {
                                    		?>
                                            <li itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                            	<h5 itemprop="name"><a href="/article/<?=$uArticles[$i]->getAlias()?>"><?=$uArticles[$i]->getTitle()?></a></h5>
                                            </li>
                                            <?php
                                    		} 
                                            ?>
                                        </ul>
                                    </div>
                                </div>
                            </section>
                            <?php 
                    		}
                            ?>
                            <!-- other articles
                    		================================================== -->
                    		<?php 
                    		if ($cArticles != NULL && count($cArticles) > 0) {
                    		?>
                            <section>
                            	<div class="module-6">
                            		<h3 class="title">Other articles</h3>
                                    <div class="moduleContent">
                                    	<ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    		<?php 
                                    		for ($i = 0; $i < count($cArticles); $i++) {
                                    		?>
                                            <li itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                            	<h5 itemprop="name"><a href="/article/<?=$cArticles[$i]->getAlias()?>"><?=$cArticles[$i]->getTitle()?></a></h5>
                                            </li>
                                            <?php 
                                    		} 
                                    		?>
                                        </ul>
                                    </div>
                                </div>
                            </section>
                            <?php 
                    		}
                            ?>
                        </div>
                    </div>

                    <!-- sidebar
                    ================================================== -->
                    <div class="span4">
                        <aside>
                        
                        	<!-- Search
        					================================================== -->
                        	<div class="module-2">
                                <h3 class="title">Search this site</h3>
                                <div class="moduleContent">
                                    <form method="get" action="/search" class="form-inline">
                                    	<input type="text" placeholder="Search article" class="" name="q"  />
                                        <button type="submit" class="btn">Search</button>
                                    </form>
                                </div>
                            </div>
                            
                            <!-- Adv
        					================================================== -->
                            <div class="module-2">                                
                                <div class="moduleContent adv-sidebar">
                                    <!-- Adv adsense BEGIN -->
                                    <script type="text/javascript"><!--
									google_ad_client = "ca-pub-2883566427648799";
									/* 300x250 */
									google_ad_slot = "2688877886";
									google_ad_width = 300;
									google_ad_height = 250;
									//-->
									</script>
									<script type="text/javascript"
									src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
									</script>
                                    <!-- Adv adsense END -->
                                </div>
                            </div>
                            
                            <!-- Recent article
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Recent article view</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php 
                                    	foreach ($lastestArticles as $key => $article) {
                                    	?>
                                    	<li itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                        	<h5 itemprop="name" class="articleTitle"><a href="/article/<?=$article->getAlias()?>" itemprop="url"><?=$article->getTitle()?></a></h5>
                                            <span itemprop="dateCreated"><?=date("M, d Y", $article->getCreated())?></span>
                                        </li>
                                        <?php 
                                    	}
                                        ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Categories
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Categories</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php
                                    	foreach ($lstCategories as $key => $category) { 
                                    	?>
                                    	<li itemprop="itemListElement"><i class="icon-share-alt"></i> <a itemprop="url" href="/category/<?=$category->getAlias()?>"><span itemprop="name"><?=$category->getName()?></span></a></li>
                                    	<?php } ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Tags
        					================================================== -->
                            <div class="module-2">
                            	<h3 class="title">Tags</h3>                            
                                <div class="moduleContent" itemscope itemtype="http://schema.org/CreativeWork">
                                	<?php 
                                	foreach ($tags as $key => $tag) {
                                	?>
                                    <a href="/tag/<?=urlencode($tag)?>" class="label label-info" itemprop="keywords"><?=$tag?></a>
                                    <?php 
                                	}
                                    ?>
                                </div>
                            </div>
                        </aside>
                    </div>
                </div>
            </div>
